<?php
// src/Acme/MainBundle/Menu/MenuBuilder.php

namespace TableTennis\MainBundle\Menu;

use Knp\Menu\FactoryInterface;
use Symfony\Component\HttpFoundation\Request;

class MenuBuilder
{
    private $factory;

    /**
     * @param FactoryInterface $factory
     */
    public function __construct(FactoryInterface $factory)
    {
        $this->factory = $factory;
    }

    public function createMainMenu(Request $request)
    {
        $menu = $this->factory->createItem('root');
        //$menu->setCurrentUri($request->getRequestUri());

        $menu->addChild('Home', array('route' => '_homepage', 'label' => 'Accueil', 'attributes' => array('class' => 'num1')));
        $menu['Home']->setCurrent(true);
        
        $menu->addChild('News', array('route' => '_baseNewsIndex', 'label' => 'Actualités', 'attributes' => array('class' => 'num2')));
        $menu->addChild('Partners', array('route' => '_tableTennisPartnerIndex', 'label' => 'Partenaires', 'attributes' => array('class' => 'num1')));
        $menu->addChild('Forum', array('route' => 'herzult_forum_index', 'label' => 'Forum', 'attributes' => array('class' => 'num2')));
        $menu->addChild('Photos', array('route' => '_basePicsIndex', 'label' => 'Galerie photos', 'attributes' => array('class' => 'num1')));
        $menu->addChild('Videos', array('route' => '_baseVideosIndex', 'label' => 'Vidéos', 'attributes' => array('class' => 'num2')));
        
        $menu->addChild('Club', array('uri' => '#le-club', 'label' => 'Le Club', 'attributes' => array('class' => 'level_0 num1')));
        $menu['Club']->addChild('Presentation', array('route' => '_basePageIndex', 
                                                      'routeParameters' => array('slug' => 'presentation-du-club'),
                                                      'label' => 'Présentation'));
        $menu['Club']->addChild('Licensees', array('route' => '_tableTennisLicenseeIndex', 'label' => 'Licenciés'));
        $menu['Club']->addChild('Teams', array('route' => '_tableTennisTeamIndex', 'label' => 'Les équipes'));
        $menu['Club']->addChild('ParticipationFeeClub', array('route' => '_basePageIndex',
                                                              'routeParameters' => array('slug' => 'participation-du-club-au-frais'),
                                                              'label' => 'Participation du club au frais'));
        $menu['Club']->addChild('Contact', array('route' => '_baseContactIndex', 'label' => 'Nous Contacter'));
        $menu['Club']->addChild('Find', array('route' => '_baseGoogleMapIndex', 'label' => 'Nous Trouver'));

        $menu->addChild('TableTennis', array('uri' => '#tennis-de-table', 'label' => 'Tennis de table', 'attributes' => array('class' => 'level_0 num2')));
        $menu['TableTennis']->addChild('pointsCalculation', array('route' => '_tableTennisPointsCalculationIndex', 'label' => 'Calcul des points'));
        $menu['TableTennis']->addChild('scoringTable', array('route' => '_tableTennisScoringTableIndex', 'label' => 'Barêmes des points'));
        $menu['TableTennis']->addChild('clubsList', array('route' => '_tableTennisClubIndex', 'label' => 'Liste des clubs'));
        $menu['TableTennis']->addChild('coefficients', array('route' => '_tableTennisMatchTypeIndex', 'label' => 'Coëfficients des compétitions'));
        $menu['TableTennis']->addChild('links', array('route' => '_basePageIndex',
                                                      'routeParameters' => array('slug' => 'liens'),
                                                      'label' => 'Liens utiles'));

        $menu->addChild('Admin', array('route' => 'sonata_admin_dashboard', 'label' => 'Admin', 'attributes' => array('class' => 'num1')));
        // ... add more children

        return $menu;
    }
}
?>
